﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>JS Arrays - Dynamic arrays</title>
	<link href="styles/js-console.css" rel="stylesheet" />
</head>
<body>
	<div id="js-console"></div>
	<script src="scripts/js-console.js"></script>
	<script>

		var numbers = [1, 2, 3, 4, 5];
		jsConsole.writeLine(numbers.join("|")); //result: 1|2|3|4|5
		var tail = numbers.pop(); 	   //tail = 5;
		jsConsole.writeLine("Removed: " + tail);
		jsConsole.writeLine(numbers.join("|")); //result: 1|2|3|4
		numbers.unshift(0);
		jsConsole.writeLine("Add 0 to the head");
		jsConsole.writeLine(numbers.join("|")); //result: 0|1|2|3|4
		var head = numbers.shift();        //head=0;		   
		jsConsole.writeLine("Removed: " + head);
		jsConsole.writeLine(numbers.join("|")); //result: 1|2|3|4


	</script>
</body>
</html>
